// Magic Software, Inc.
// http://www.magic-software.com
// Copyright (c) 2000, All Rights Reserved
//
// Source code from Magic Software is supplied under the terms of a license
// agreement and may not be copied or disclosed except in accordance with the
// terms of that agreement.  The various license agreements may be found at
// the Magic Software web site.  This file is subject to the license
//
// FREE SOURCE CODE
// http://www.magic-software.com/License/free.pdf

#ifndef MGCBEZIERCURVE2_H
#define MGCBEZIERCURVE2_H

#include "MgcSingleCurve2.h"


class MgcBezierCurve2 : public MgcSingleCurve2
{
public:
    MgcBezierCurve2 (int iDegree, MgcVector2* akCtrlPoint);
    virtual ~MgcBezierCurve2 ();

    int GetDegree () const;
    const MgcVector2* GetControlPoints () const;

    virtual MgcVector2 GetPosition (MgcReal fTime) const;
    virtual MgcVector2 GetFirstDerivative (MgcReal fTime) const;
    virtual MgcVector2 GetSecondDerivative (MgcReal fTime) const;
    virtual MgcVector2 GetThirdDerivative (MgcReal fTime) const;

    virtual MgcReal GetVariation (MgcReal fT0, MgcReal fT1,
        const MgcVector2* pkP0 = 0, const MgcVector2* pkP1 = 0) const;

protected:
    int m_iDegree;
    int m_iNumCtrlPoints;
    MgcVector2* m_akCtrlPoint;
    MgcVector2* m_akDer1CtrlPoint;
    MgcVector2* m_akDer2CtrlPoint;
    MgcVector2* m_akDer3CtrlPoint;
    MgcReal** m_aafChoose;

    // variation support
    int m_iTwoDegree;
    int m_iTwoDegreePlusOne;
    MgcReal* m_afSigma;
    MgcReal* m_afRecip;
    MgcReal* m_afPowT0;
    MgcReal* m_afPowOmT0;
    MgcReal* m_afPowT1;
    MgcReal* m_afPowOmT1;
};

#include "MgcBezierCurve2.inl"

#endif
